package database_beans;
// Generated Feb 13, 2014 2:57:58 AM by Hibernate Tools 3.6.0


import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Obavestenja generated by hbm2java
 */
@Entity
@Table(name="obavestenja"
    ,catalog="pia"
)
public class Obavestenja  implements java.io.Serializable {


     private Integer idObavestenja;
     private Predmet predmet;
     private String naslov;
     private String tekst;
     private Byte arhiviran;
     private String kategorija;
     private Date datum;
     private Set<Fajlovi> fajlovis = new HashSet<Fajlovi>(0);

    public Obavestenja() {
    }

	
    public Obavestenja(String naslov, String tekst, Date datum) {
        this.naslov = naslov;
        this.tekst = tekst;
        this.datum = datum;
    }
    public Obavestenja(Predmet predmet, String naslov, String tekst, Byte arhiviran, String kategorija, Date datum, Set<Fajlovi> fajlovis) {
       this.predmet = predmet;
       this.naslov = naslov;
       this.tekst = tekst;
       this.arhiviran = arhiviran;
       this.kategorija = kategorija;
       this.datum = datum;
       this.fajlovis = fajlovis;
    }
   
     @Id @GeneratedValue(strategy=IDENTITY)

    
    @Column(name="id_obavestenja", unique=true, nullable=false)
    public Integer getIdObavestenja() {
        return this.idObavestenja;
    }
    
    public void setIdObavestenja(Integer idObavestenja) {
        this.idObavestenja = idObavestenja;
    }

@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="predmet")
    public Predmet getPredmet() {
        return this.predmet;
    }
    
    public void setPredmet(Predmet predmet) {
        this.predmet = predmet;
    }

    
    @Column(name="naslov", nullable=false, length=45)
    public String getNaslov() {
        return this.naslov;
    }
    
    public void setNaslov(String naslov) {
        this.naslov = naslov;
    }

    
    @Column(name="tekst", nullable=false, length=65535)
    public String getTekst() {
        return this.tekst;
    }
    
    public void setTekst(String tekst) {
        this.tekst = tekst;
    }

    
    @Column(name="arhiviran")
    public Byte getArhiviran() {
        return this.arhiviran;
    }
    
    public void setArhiviran(Byte arhiviran) {
        this.arhiviran = arhiviran;
    }

    
    @Column(name="kategorija", length=45)
    public String getKategorija() {
        return this.kategorija;
    }
    
    public void setKategorija(String kategorija) {
        this.kategorija = kategorija;
    }

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name="datum", nullable=false, length=19)
    public Date getDatum() {
        return this.datum;
    }
    
    public void setDatum(Date datum) {
        this.datum = datum;
    }

@ManyToMany(fetch=FetchType.LAZY)
    @JoinTable(name="fajlovi_has_obavestenja", catalog="pia", joinColumns = { 
        @JoinColumn(name="obavestenja_id_obavestenja", nullable=false, updatable=false) }, inverseJoinColumns = { 
        @JoinColumn(name="fajlovi_id_fajl", nullable=false, updatable=false) })
    public Set<Fajlovi> getFajlovis() {
        return this.fajlovis;
    }
    
    public void setFajlovis(Set<Fajlovi> fajlovis) {
        this.fajlovis = fajlovis;
    }

    @Override
    public String toString() {
        return naslov;
    }

    


}


